package com.vhly.remoteapi.util;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

/**
 * Created by IntelliJ IDEA.
 * User: vhly[FR]
 * Date: 10-12-24
 * Time: 下午1:06
 */
public final class StreamUtil {
    private StreamUtil() {

    }

    /**
     * close stream sifely
     * @param stream stream
     */
    public static void close(Object stream) {
        if (stream != null) {
            try {
                if (stream instanceof InputStream) {
                    ((InputStream) stream).close();
                } else if (stream instanceof OutputStream) {
                    ((OutputStream) stream).close();
                }
            } catch (IOException ioe) {

            }
        }
    }
}
